package NovelBar.mapper;

import NovelBar.dto.TypePageDto;
import NovelBar.entity.Book;
import NovelBar.dto.BooksLabelInfo;
import NovelBar.entity.Label;
import NovelBar.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface BookMapper {
    List<Book> loadAllBook();
    List<Integer> loadBookByTableId(Integer tableId);
    Book loadBookById(Integer id);
    Integer loadLabelIdByLabel(String label);
    List<Book> loadBookByWid(Integer wid);
    List<Book> loadBookByLabelNum(@Param("labelId") int labelId,@Param("endNum") int endNum);
    List<BooksLabelInfo> getLabelByBookId(Integer id);
    void insertBook(Book book);
    List<Label> loadAllLabel();
    Integer loadMaxIdFromBook();
    void insertBookLabel(@Param("bookid") Integer bookid, @Param("labelid") Integer labelid);
    void deleteBookById(Integer id);
    void recommendBook(Integer id);
    User loadUserByBookId(Integer bid);
    List<Book> loadIsBookByEnd(String isEnd);
    List<Integer> loadUserBookByUid(Integer uid);
    void insertUserBook(@Param("uid") Integer uid, @Param("bookid") Integer bookid);
    void deleteUserBookBy(@Param("uid") Integer uid, @Param("bookid") Integer bookid);
    Integer loadUserBookByUidBookid(@Param("uid") Integer uid, @Param("bookid") Integer bookid);
    void addCollectionByBookid(Integer bookid);
    void subCollectionByBookid(Integer bookid);
    List<Book> loadUserBookByIsEndLabel(@Param("labelId") Integer labelId, @Param("isEnd") String isEnd);
    int addClickByBookId(Integer bookId);
    List<Book> loadBookByIsFreeIsEndLabel(TypePageDto typePageDto);
    List<Book> searchAuthorAndTitle(String input);
    void delete13(Integer bid);
    void endBook(Integer id);
}
